#ifndef TICKETS_H_
#define TICKETS_H_
#define MAX_FILEL		128
#define TICKET_LEN		33

typedef struct{
	int dtime;
	int etime;
	int ftime;
	char id[TICKET_LEN];
	int retries;
}ticketP;

typedef char * ticketT;

int	GetTicketParameters(char * database, char * md5, ticketP * tickp);
int RemoveTicket(char * database, ticketT md5);
int IncreaseRetries(char * database, ticketT md5,ticketP * tickp);
char * createId(char * filename, int pid, int dtime);
short TicketExists(char * database, char * id, char * ip);
int CreateTicket(char * database, char * filename, int pid, ticketP * tickp, 
				char * ip);
void printTicketParameters(ticketP * tickp);
int fileExists(char * filename);
int TicketsLeft(char * database, int login);
int IncTickets(char * database, int login);
void printTicketParameters(ticketP * tickp);

#endif /*TICKETS_H_*/
